package com.application.lucky.manager;

import com.application.lucky.bean.jsonBean.GroupListbean;
import com.application.lucky.utils.ConnUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * create by liulp
 * on 2019-11-14 20:57
 */
public class GroupDataManager {
    // 赶工期暂时这样实现，后期优化

    private static volatile GroupDataManager instance;

    private GroupDataManager() {

    }

    private List<GroupListbean> dataInfo = new ArrayList<>();

    public static GroupDataManager getInstance() {
        if (instance == null) {
            synchronized (GroupDataManager.class) {
                if (instance == null) {
                    instance = new GroupDataManager();
                }
            }
        }
        return instance;
    }

    public List<GroupListbean> getDataInfo() {
        return dataInfo;
    }

    public void setDataInfo(List<GroupListbean> listbeans) {
        if(ConnUtil.isEmpty(listbeans)){
            return;
        }
        dataInfo.clear();
        for (GroupListbean item : listbeans) {
            if (!dataInfo.contains(item)) {
                dataInfo.add(item);
            }
        }
    }


}
